var express = require('express');
var fs = require('fs');
var router = express.Router();
/* GET home page. */
  
module.exports = function (Config,__dirname) {  
    router.get(['/:id/.png'], function (req, res, next) {
      console.log(__dirname)
        var params = req.params;
       var info =Config[params.id];
     var filepath=  info.src;
        fs.exists(filepath, function (exists) {
          if (exists) {
            res.sendfile(filepath);
          } else {
            next()
          }
        })
      });
      return router;
    }